home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Technology Seed / Jan. '98 ATS.toast / QuickTime™ 3.0b11 / QTPublicInterfaces / PInterfaces / QuickTimeMusic.p < prev   
Encoding:
Text File  |  1998-01-12  |  71.2 KB  |  1,637 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        QuickTimeMusic.p
  3.  
  4.      Contains:    QuickTime interfaces
  5.  
  6.      Version:    Technology:    
  7.                  Release:    QuickTime 3.0 Beta
  8.  
  9.      Copyright:    © 1990-1997 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        Please include the the file and version information (from above) with
  12.                  the problem description.  Developers belonging to one of the Apple
  13.                  developer programs can submit bug reports to:
  14.  
  15.                      devsupport@apple.com
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT QuickTimeMusic;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __QUICKTIMEMUSIC__}
  28. {$SETC __QUICKTIMEMUSIC__ := 1}
  29.  
  30. {$I+}
  31. {$SETC QuickTimeMusicIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __COMPONENTS__}
  35. {$I Components.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __IMAGECOMPRESSION__}
  38. {$I ImageCompression.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __MOVIES__}
  41. {$I Movies.p}
  42. {$ENDC}
  43. {$IFC UNDEFINED __QUICKDRAW__}
  44. {$I Quickdraw.p}
  45. {$ENDC}
  46. {$IFC UNDEFINED __VIDEO__}
  47. {$I Video.p}
  48. {$ENDC}
  49. {$IFC UNDEFINED __MACMEMORY__}
  50. {$I MacMemory.p}
  51. {$ENDC}
  52. {$IFC UNDEFINED __SOUND__}
  53. {$I Sound.p}
  54. {$ENDC}
  55.  
  56.  
  57. {$PUSH}
  58. {$ALIGN MAC68K}
  59. {$LibExport+}
  60.  
  61.  
  62. CONST
  63.     kaiToneDescType                = 'tone';
  64.     kaiNoteRequestInfoType        = 'ntrq';
  65.     kaiKnobListType                = 'knbl';
  66.     kaiKeyRangeInfoType            = 'sinf';
  67.     kaiSampleDescType            = 'sdsc';
  68.     kaiSampleInfoType            = 'smin';
  69.     kaiSampleDataType            = 'sdat';
  70.     kaiSampleDataQUIDType        = 'quid';
  71.     kaiInstInfoType                = 'iinf';
  72.     kaiPictType                    = 'pict';
  73.     kaiWriterType                = '©wrt';
  74.     kaiCopyrightType            = '©cpy';
  75.     kaiOtherStrType                = 'str ';
  76.     kaiInstrumentRefType        = 'iref';
  77.     kaiInstGMQualityType        = 'qual';
  78.     kaiLibraryInfoType            = 'linf';
  79.     kaiLibraryDescType            = 'ldsc';
  80.  
  81.  
  82. TYPE
  83.     InstLibDescRecPtr = ^InstLibDescRec;
  84.     InstLibDescRec = RECORD
  85.         libIDName:                Str31;
  86.     END;
  87.  
  88.     InstKnobRecPtr = ^InstKnobRec;
  89.     InstKnobRec = RECORD
  90.         number:                    BigEndianLong;
  91.         value:                    BigEndianLong;
  92.     END;
  93.  
  94.  
  95. CONST
  96.     kInstKnobMissingUnknown        = 0;
  97.     kInstKnobMissingDefault        = $01;
  98.  
  99.  
  100. TYPE
  101.     InstKnobListPtr = ^InstKnobList;
  102.     InstKnobList = RECORD
  103.         knobCount:                BigEndianLong;
  104.         knobFlags:                BigEndianLong;
  105.         knob:                    ARRAY [0..0] OF InstKnobRec;
  106.     END;
  107.  
  108.  
  109. CONST
  110.     kMusicLoopTypeNormal        = 0;
  111.     kMusicLoopTypePalindrome    = 1;                            {  back & forth }
  112.  
  113.     instSamplePreProcessFlag    = $01;
  114.  
  115.  
  116. TYPE
  117.     InstSampleDescRecPtr = ^InstSampleDescRec;
  118.     InstSampleDescRec = RECORD
  119.         dataFormat:                BigEndianOSType;
  120.         numChannels:            BigEndianShort;
  121.         sampleSize:                BigEndianShort;
  122.         sampleRate:                BigEndianUnsignedFixed;
  123.         sampleDataID:            BigEndianShort;
  124.         offset:                    BigEndianLong;                            {  offset within SampleData - this could be just for internal use }
  125.         numSamples:                BigEndianLong;                            {  this could also just be for internal use, we'll see }
  126.         loopType:                BigEndianLong;
  127.         loopStart:                BigEndianLong;
  128.         loopEnd:                BigEndianLong;
  129.         pitchNormal:            BigEndianLong;
  130.         pitchLow:                BigEndianLong;
  131.         pitchHigh:                BigEndianLong;
  132.     END;
  133.  
  134.     AtomicInstrument                    = Handle;
  135.     AtomicInstrumentPtr                    = Ptr;
  136.  
  137. CONST
  138.     kQTMIDIComponentType        = 'midi';
  139.  
  140.     kOMSComponentSubType        = 'OMS ';
  141.     kFMSComponentSubType        = 'FMS ';
  142.     kMIDIManagerComponentSubType = 'mmgr';
  143.  
  144.  
  145. TYPE
  146.     QTMIDIComponent                        = ComponentInstance;
  147.  
  148. CONST
  149.     kMusicPacketPortLost        = 1;                            {  received when application loses the default input port  }
  150.     kMusicPacketPortFound        = 2;                            {  received when application gets it back out from under someone else's claim  }
  151.     kMusicPacketTimeGap            = 3;                            {  data[0] = number of milliseconds to keep the MIDI line silent  }
  152.  
  153.     kAppleSysexID                = $11;                            {  apple sysex is followed by 2-byte command. 0001 is the command for samplesize  }
  154.     kAppleSysexCmdSampleSize    = $0001;                        {  21 bit number in 3 midi bytes follows sysex ID and 2 cmd bytes  }
  155.     kAppleSysexCmdSampleBreak    = $0002;                        {  specifies that the sample should break right here  }
  156.     kAppleSysexCmdAtomicInstrument = $0010;                        {  contents of atomic instrument handle  }
  157.     kAppleSysexCmdDeveloper        = $7F00;                        {  F0 11 7F 00 ww xx yy zz ... F7 is available for non-Apple developers, where wxyz is unique app signature with 8th bit cleared, unique to developer, and 00 and 7f are reserved  }
  158.  
  159.  
  160. TYPE
  161.     MusicMIDIPacketPtr = ^MusicMIDIPacket;
  162.     MusicMIDIPacket = RECORD
  163.         length:                    UInt16;
  164.         reserved:                UInt32;                                    {  if length zero, then reserved = above enum  }
  165.         data:                    PACKED ARRAY [0..248] OF UInt8;
  166.     END;
  167.  
  168. {$IFC TYPED_FUNCTION_POINTERS}
  169.     MusicMIDISendProcPtr = FUNCTION(self: ComponentInstance; refCon: LONGINT; VAR mmp: MusicMIDIPacket): ComponentResult;
  170. {$ELSEC}
  171.     MusicMIDISendProcPtr = ProcPtr;
  172. {$ENDC}
  173.  
  174.     MusicMIDISendUPP = UniversalProcPtr;
  175. {$IFC TYPED_FUNCTION_POINTERS}
  176.     MusicMIDIReadHookProcPtr = FUNCTION(VAR mp: MusicMIDIPacket; myRefCon: LONGINT): ComponentResult;
  177. {$ELSEC}
  178.     MusicMIDIReadHookProcPtr = ProcPtr;
  179. {$ENDC}
  180.  
  181.     MusicMIDIReadHookUPP = UniversalProcPtr;
  182.  
  183. CONST
  184.     kSynthesizerConnectionFMS    = 1;                            {  this connection imported from FMS  }
  185.     kSynthesizerConnectionMMgr    = 2;                            {  this connection imported from the MIDI Mgr  }
  186.     kSynthesizerConnectionOMS    = 4;                            {  this connection imported from OMS  }
  187.     kSynthesizerConnectionQT    = 8;                            {  this connection is a QuickTime-only port  }
  188.                                                                 {  lowest four bits are mutually exclusive; combinations reserved for future use. }
  189.     kSynthesizerConnectionUnavailable = 256;                    {  port exists, but cannot be used just now  }
  190.  
  191.  
  192. TYPE
  193.     SynthesizerConnectionsPtr = ^SynthesizerConnections;
  194.     SynthesizerConnections = RECORD
  195.         clientID:                OSType;
  196.         inputPortID:            OSType;                                    {  terminology death: this port is used to SEND to the midi synth  }
  197.         outputPortID:            OSType;                                    {  terminology death: this port receives from a keyboard or other control device  }
  198.         midiChannel:            LONGINT;                                {  The system channel; others are configurable (or the nubus slot number)  }
  199.         flags:                    LONGINT;
  200.         unique:                    LONGINT;                                {  unique id may be used instead of index, to getinfo and unregister calls  }
  201.         reserved1:                LONGINT;                                {  should be zero  }
  202.         reserved2:                LONGINT;                                {  should be zero  }
  203.     END;
  204.  
  205.     QTMIDIPortPtr = ^QTMIDIPort;
  206.     QTMIDIPort = RECORD
  207.         portConnections:        SynthesizerConnections;
  208.         portName:                Str63;
  209.     END;
  210.  
  211.     QTMIDIPortListPtr = ^QTMIDIPortList;
  212.     QTMIDIPortList = RECORD
  213.         portCount:                INTEGER;
  214.         port:                    ARRAY [0..0] OF QTMIDIPort;
  215.     END;
  216.  
  217.     QTMIDIPortListHandle                = ^QTMIDIPortListPtr;
  218. FUNCTION QTMIDIGetMIDIPorts(ci: QTMIDIComponent; VAR inputPorts: QTMIDIPortListHandle; VAR outputPorts: QTMIDIPortListHandle): ComponentResult;
  219.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  220.     INLINE $2F3C, $0008, $0001, $7000, $A82A;
  221.     {$ENDC}
  222. FUNCTION QTMIDIUseSendPort(ci: QTMIDIComponent; portIndex: LONGINT; inUse: LONGINT): ComponentResult;
  223.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  224.     INLINE $2F3C, $0008, $0002, $7000, $A82A;
  225.     {$ENDC}
  226. FUNCTION QTMIDISendMIDI(ci: QTMIDIComponent; portIndex: LONGINT; VAR mp: MusicMIDIPacket): ComponentResult;
  227.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  228.     INLINE $2F3C, $0008, $0003, $7000, $A82A;
  229.     {$ENDC}
  230. FUNCTION QTMIDIUseReceivePort(ci: QTMIDIComponent; portIndex: LONGINT; readHook: MusicMIDIReadHookUPP; refCon: LONGINT): ComponentResult;
  231.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  232.     INLINE $2F3C, $000C, $0004, $7000, $A82A;
  233.     {$ENDC}
  234.  
  235.  
  236.  
  237. CONST
  238.     kMusicComponentType            = 'musi';
  239.     kInstrumentComponentType    = 'inst';
  240.  
  241.     kSoftSynthComponentSubType    = 'ss  ';
  242.     kGMSynthComponentSubType    = 'gm  ';
  243.  
  244.  
  245.  
  246. TYPE
  247.     MusicComponent                        = ComponentInstance;
  248. {  MusicSynthesizerFlags }
  249.  
  250. CONST
  251.     kSynthesizerDynamicVoice    = $01;                            {  can assign voices on the fly (else, polyphony is very important  }
  252.     kSynthesizerUsesMIDIPort    = $02;                            {  must be patched through MIDI Manager  }
  253.     kSynthesizerMicrotone        = $04;                            {  can play microtonal scales  }
  254.     kSynthesizerHasSamples        = $08;                            {  synthesizer has some use for sampled data  }
  255.     kSynthesizerMixedDrums        = $10;                            {  any part can play drum parts, total = instrument parts  }
  256.     kSynthesizerSoftware        = $20;                            {  implemented in main CPU software == uses cpu cycles  }
  257.     kSynthesizerHardware        = $40;                            {  is a hardware device (such as nubus, or maybe DSP?)  }
  258.     kSynthesizerDynamicChannel    = $80;                            {  can move any part to any channel or disable each part. (else we assume it lives on all channels in masks)  }
  259.     kSynthesizerHogsSystemChannel = $0100;                        {  can be channelwise dynamic, but always responds on its system channel  }
  260.     kSynthesizerHasSystemChannel = $0200;                        {  has some "system channel" notion to distinguish it from multiple instances of the same device (GM devices dont)  }
  261.     kSynthesizerSlowSetPart        = $0400;                        {  SetPart() and SetPartInstrumentNumber() calls do not have rapid response, may glitch notes  }
  262.     kSynthesizerOffline            = $1000;                        {  can enter an offline synthesis mode  }
  263.     kSynthesizerGM                = $4000;                        {  synth is a GM device  }
  264.     kSynthesizerDLS                = $8000;                        {  synth supports DLS level 1  }
  265.     kSynthesizerSoundLocalization = $00010000;                    {  synth supports extremely baroque, nonstandard, and proprietary "apple game sprockets" localization parameter set  }
  266.  
  267. {
  268.  * Note that these controller numbers
  269.  * are _not_ identical to the MIDI controller numbers.
  270.  * These are _signed_ 8.8 values, and the LSB's are
  271.  * always sent to a MIDI device. Controllers 32-63 are
  272.  * reserved (for MIDI, they are LSB's for 0-31, but we
  273.  * always send both).
  274.  *
  275.  * The full range, therefore, is -128.00 to 127.7f.
  276.  *
  277.  * _Excepting_ _volume_, all controls default to zero.
  278.  *
  279.  * Pitch bend is specified in fractional semitones! No
  280.  * more "pitch bend range" nonsense. You can bend as far
  281.  * as you want, any time you want.
  282.  }
  283.  
  284. TYPE
  285.     MusicController                        = SInt32;
  286.  
  287. CONST
  288.     kControllerModulationWheel    = 1;
  289.     kControllerBreath            = 2;
  290.     kControllerFoot                = 4;
  291.     kControllerPortamentoTime    = 5;                            {  time in 8.8 seconds, portamento on/off is omitted, 0 time = 'off'  }
  292.     kControllerVolume            = 7;
  293.     kControllerBalance            = 8;
  294.     kControllerPan                = 10;                            {  0 - "default", 1 - n: positioned in output 1-n (incl fractions)  }
  295.     kControllerExpression        = 11;
  296.     kControllerLever1            = 16;                            {  general purpose controllers  }
  297.     kControllerLever2            = 17;                            {  general purpose controllers  }
  298.     kControllerLever3            = 18;                            {  general purpose controllers  }
  299.     kControllerLever4            = 19;                            {  general purpose controllers  }
  300.     kControllerLever5            = 80;                            {  general purpose controllers  }
  301.     kControllerLever6            = 81;                            {  general purpose controllers  }
  302.     kControllerLever7            = 82;                            {  general purpose controllers  }
  303.     kControllerLever8            = 83;                            {  general purpose controllers  }
  304.     kControllerPitchBend        = 32;                            {  positive & negative semitones, with 7 bits fraction  }
  305.     kControllerAfterTouch        = 33;                            {  aka channel pressure  }
  306.     kControllerSustain            = 64;                            {  boolean - positive for on, 0 or negative off  }
  307.     kControllerSostenuto        = 66;                            {  boolean  }
  308.     kControllerSoftPedal        = 67;                            {  boolean  }
  309.     kControllerReverb            = 91;
  310.     kControllerTremolo            = 92;
  311.     kControllerChorus            = 93;
  312.     kControllerCeleste            = 94;
  313.     kControllerPhaser            = 95;
  314.     kControllerEditPart            = 113;                            {  last 16 controllers 113-128 and above are global controllers which respond on part zero  }
  315.     kControllerMasterTune        = 114;
  316.  
  317.  
  318. {  ID's of knobs supported by the QuickTime Music Synthesizer built into QuickTime }
  319.  
  320.     kQTMSKnobStartID            = $02000000;
  321.     kQTMSKnobVolumeAttackTimeID    = $02000001;                    {  sample can override }
  322.     kQTMSKnobVolumeDecayTimeID    = $02000002;                    {  sample can override }
  323.     kQTMSKnobVolumeSustainLevelID = $02000003;                    {  sample can override }
  324.     kQTMSKnobVolumeRelease1RateID = $02000004;                    { •••• OBSOLETE ME! }
  325.     kQTMSKnobVolumeReleaseKeyScalingID = $02000005;
  326.     kQTMSKnobVolumeReleaseTimeID = $02000006;                    {  sample can override }
  327.     kQTMSKnobVolumeLFODelayID    = $02000007;
  328.     kQTMSKnobVolumeLFORampTimeID = $02000008;
  329.     kQTMSKnobVolumeLFOPeriodID    = $02000009;
  330.     kQTMSKnobVolumeLFOShapeID    = $0200000A;
  331.     kQTMSKnobVolumeLFODepthID    = $0200000B;
  332.     kQTMSKnobVolumeOverallID    = $0200000C;
  333.     kQTMSKnobVolumeVelocity127ID = $0200000D;
  334.     kQTMSKnobVolumeVelocity96ID    = $0200000E;
  335.     kQTMSKnobVolumeVelocity64ID    = $0200000F;
  336.     kQTMSKnobVolumeVelocity32ID    = $02000010;
  337.     kQTMSKnobVolumeVelocity16ID    = $02000011;                    {  Pitch related knobs }
  338.     kQTMSKnobPitchTransposeID    = $02000012;                    {  sample can override }
  339.     kQTMSKnobPitchLFODelayID    = $02000013;
  340.     kQTMSKnobPitchLFORampTimeID    = $02000014;
  341.     kQTMSKnobPitchLFOPeriodID    = $02000015;
  342.     kQTMSKnobPitchLFOShapeID    = $02000016;
  343.     kQTMSKnobPitchLFODepthID    = $02000017;
  344.     kQTMSKnobPitchLFOQuantizeID    = $02000018;                    {  Stereo related knobs }
  345.     kQTMSKnobStereoDefaultPanID    = $02000019;
  346.     kQTMSKnobStereoPositionKeyScalingID = $0200001A;
  347.     kQTMSKnobPitchLFOOffsetID    = $0200001B;
  348.     kQTMSKnobExclusionGroupID    = $0200001C;                    {  Misc knobs, late additions }
  349.     kQTMSKnobSustainTimeID        = $0200001D;
  350.     kQTMSKnobSustainInfiniteID    = $0200001E;
  351.     kQTMSKnobVolumeLFOStereoID    = $0200001F;
  352.     kQTMSKnobVelocityLowID        = $02000020;
  353.     kQTMSKnobVelocityHighID        = $02000021;
  354.     kQTMSKnobVelocitySensitivityID = $02000022;
  355.     kQTMSKnobPitchSensitivityID    = $02000023;
  356.     kQTMSKnobVolumeLFODepthFromWheelID = $02000024;
  357.     kQTMSKnobPitchLFODepthFromWheelID = $02000025;                {  Volume Env again }
  358.     kQTMSKnobVolumeExpOptionsID    = $02000026;                    {  Env1 }
  359.     kQTMSKnobEnv1AttackTimeID    = $02000027;
  360.     kQTMSKnobEnv1DecayTimeID    = $02000028;
  361.     kQTMSKnobEnv1SustainLevelID    = $02000029;
  362.     kQTMSKnobEnv1SustainTimeID    = $0200002A;
  363.     kQTMSKnobEnv1SustainInfiniteID = $0200002B;
  364.     kQTMSKnobEnv1ReleaseTimeID    = $0200002C;
  365.     kQTMSKnobEnv1ExpOptionsID    = $0200002D;                    {  Env2 }
  366.     kQTMSKnobEnv2AttackTimeID    = $0200002E;
  367.     kQTMSKnobEnv2DecayTimeID    = $0200002F;
  368.     kQTMSKnobEnv2SustainLevelID    = $02000030;
  369.     kQTMSKnobEnv2SustainTimeID    = $02000031;
  370.     kQTMSKnobEnv2SustainInfiniteID = $02000032;
  371.     kQTMSKnobEnv2ReleaseTimeID    = $02000033;
  372.     kQTMSKnobEnv2ExpOptionsID    = $02000034;                    {  Pitch Env }
  373.     kQTMSKnobPitchEnvelopeID    = $02000035;
  374.     kQTMSKnobPitchEnvelopeDepthID = $02000036;                    {  Filter }
  375.     kQTMSKnobFilterKeyFollowID    = $02000037;
  376.     kQTMSKnobFilterTransposeID    = $02000038;
  377.     kQTMSKnobFilterQID            = $02000039;
  378.     kQTMSKnobFilterFrequencyEnvelopeID = $0200003A;
  379.     kQTMSKnobFilterFrequencyEnvelopeDepthID = $0200003B;
  380.     kQTMSKnobFilterQEnvelopeID    = $0200003C;
  381.     kQTMSKnobFilterQEnvelopeDepthID = $0200003D;                {  Reverb Threshhold }
  382.     kQTMSKnobReverbThresholdID    = $0200003E;
  383.     kQTMSKnobLastIDPlus1        = $0200003F;
  384.  
  385.  
  386.  
  387.  
  388.     kControllerMaximum            = $7FFF;                        {  +01111111.11111111  }
  389.     kControllerMinimum            = $8000;                        {  -10000000.00000000  }
  390.  
  391.  
  392. TYPE
  393.     SynthesizerDescriptionPtr = ^SynthesizerDescription;
  394.     SynthesizerDescription = RECORD
  395.         synthesizerType:        OSType;                                    {  synthesizer type (must be same as component subtype)  }
  396.         name:                    Str31;                                    {  text name of synthesizer type  }
  397.         flags:                    UInt32;                                    {  from the above enum  }
  398.         voiceCount:                UInt32;                                    {  maximum polyphony  }
  399.         partCount:                UInt32;                                    {  maximum multi-timbrality (and midi channels)  }
  400.         instrumentCount:        UInt32;                                    {  non gm, built in (rom) instruments only  }
  401.         modifiableInstrumentCount: UInt32;                                {  plus n-more are user modifiable  }
  402.         channelMask:            UInt32;                                    {  (midi device only) which channels device always uses  }
  403.         drumPartCount:            UInt32;                                    {  maximum multi-timbrality of drum parts  }
  404.         drumCount:                UInt32;                                    {  non gm, built in (rom) drumkits only  }
  405.         modifiableDrumCount:    UInt32;                                    {  plus n-more are user modifiable  }
  406.         drumChannelMask:        UInt32;                                    {  (midi device only) which channels device always uses  }
  407.         outputCount:            UInt32;                                    {  number of audio outputs (usually two)  }
  408.         latency:                UInt32;                                    {  response time in µSec  }
  409.         controllers:            ARRAY [0..3] OF UInt32;                    {  array of 128 bits  }
  410.         gmInstruments:            ARRAY [0..3] OF UInt32;                    {  array of 128 bits  }
  411.         gmDrums:                ARRAY [0..3] OF UInt32;                    {  array of 128 bits  }
  412.     END;
  413.  
  414.  
  415. CONST
  416.     kVoiceCountDynamic            = -1;                            {  constant to use to specify dynamic voicing  }
  417.  
  418.  
  419.  
  420. TYPE
  421.     ToneDescriptionPtr = ^ToneDescription;
  422.     ToneDescription = RECORD
  423.         synthesizerType:        BigEndianOSType;                        {  synthesizer type  }
  424.         synthesizerName:        Str31;                                    {  name of instantiation of synth  }
  425.         instrumentName:            Str31;                                    {  preferred name for human use  }
  426.         instrumentNumber:        BigEndianLong;                            {  inst-number used if synth-name matches  }
  427.         gmNumber:                BigEndianLong;                            {  Best matching general MIDI number  }
  428.     END;
  429.  
  430.  
  431. CONST
  432.     kFirstGMInstrument            = $00000001;
  433.     kLastGMInstrument            = $00000080;
  434.     kFirstGSInstrument            = $00000081;
  435.     kLastGSInstrument            = $00003FFF;
  436.     kFirstDrumkit                = $00004000;                    {  (first value is "no drum". instrument numbers from 16384->16384+128 are drumkits, and for GM they are _defined_ drumkits!  }
  437.     kLastDrumkit                = $00004080;
  438.     kFirstROMInstrument            = $00008000;
  439.     kLastROMInstrument            = $0000FFFF;
  440.     kFirstUserInstrument        = $00010000;
  441.     kLastUserInstrument            = $0001FFFF;
  442.  
  443. {  InstrumentMatch }
  444.     kInstrumentMatchSynthesizerType = 1;
  445.     kInstrumentMatchSynthesizerName = 2;
  446.     kInstrumentMatchName        = 4;
  447.     kInstrumentMatchNumber        = 8;
  448.     kInstrumentMatchGMNumber    = 16;
  449.     kInstrumentMatchGSNumber    = 32;
  450.  
  451. {  KnobFlags }
  452.     kKnobBasic                    = 8;                            {  knob shows up in certain simplified lists of knobs  }
  453.     kKnobReadOnly                = 16;                            {  knob value cannot be changed by user or with a SetKnob call  }
  454.     kKnobInterruptUnsafe        = 32;                            {  only alter this knob from foreground task time (may access toolbox)  }
  455.     kKnobKeyrangeOverride        = 64;                            {  knob can be overridden within a single keyrange (software synth only)  }
  456.     kKnobGroupStart                = 128;                            {  knob is first in some logical group of knobs  }
  457.     kKnobFixedPoint8            = 1024;
  458.     kKnobFixedPoint16            = 2048;                            {  One of these may be used at a time.  }
  459.     kKnobTypeNumber                = $00;
  460.     kKnobTypeGroupName            = $1000;                        {  "knob" is really a group name for display purposes  }
  461.     kKnobTypeBoolean            = $2000;                        {  if range is greater than 1, its a multi-checkbox field  }
  462.     kKnobTypeNote                = $3000;                        {  knob range is equivalent to MIDI keys  }
  463.     kKnobTypePan                = $4000;                        {  range goes left/right (lose this? )  }
  464.     kKnobTypeInstrument            = $5000;                        {  knob value = reference to another instrument number  }
  465.     kKnobTypeSetting            = $6000;                        {  knob value is 1 of n different things (eg, fm algorithms) popup menu  }
  466.     kKnobTypeMilliseconds        = $7000;                        {  knob is a millisecond time range  }
  467.     kKnobTypePercentage            = $8000;                        {  knob range is displayed as a Percentage  }
  468.     kKnobTypeHertz                = $9000;                        {  knob represents frequency  }
  469.     kKnobTypeButton                = $A000;                        {  momentary trigger push button  }
  470.  
  471.  
  472.     kUnknownKnobValue            = $7FFFFFFF;                    {  a knob with this value means, we don't know it.  }
  473.     kDefaultKnobValue            = $7FFFFFFE;                    {  used to SET a knob to its default value.  }
  474.  
  475.  
  476. TYPE
  477.     KnobDescriptionPtr = ^KnobDescription;
  478.     KnobDescription = RECORD
  479.         name:                    Str63;
  480.         lowValue:                LONGINT;
  481.         highValue:                LONGINT;
  482.         defaultValue:            LONGINT;                                {  a default instrument is made of all default values  }
  483.         flags:                    LONGINT;
  484.         knobID:                    LONGINT;
  485.     END;
  486.  
  487.     GCInstrumentDataPtr = ^GCInstrumentData;
  488.     GCInstrumentData = RECORD
  489.         tone:                    ToneDescription;
  490.         knobCount:                LONGINT;
  491.         knob:                    ARRAY [0..0] OF LONGINT;
  492.     END;
  493.  
  494.     GCInstrumentDataHandle                = ^GCInstrumentDataPtr;
  495.     InstrumentAboutInfoPtr = ^InstrumentAboutInfo;
  496.     InstrumentAboutInfo = RECORD
  497.         p:                        PicHandle;
  498.         author:                    Str255;
  499.         copyright:                Str255;
  500.         other:                    Str255;
  501.     END;
  502.  
  503.  
  504.  
  505. CONST
  506.     notImplementedMusicErr        = $8000F7E9;
  507.     cantSendToSynthesizerErr    = $8000F7E8;
  508.     cantReceiveFromSynthesizerErr = $8000F7E7;
  509.     illegalVoiceAllocationErr    = $8000F7E6;
  510.     illegalPartErr                = $8000F7E5;
  511.     illegalChannelErr            = $8000F7E4;
  512.     illegalKnobErr                = $8000F7E3;
  513.     illegalKnobValueErr            = $8000F7E2;
  514.     illegalInstrumentErr        = $8000F7E1;
  515.     illegalControllerErr        = $8000F7E0;
  516.     midiManagerAbsentErr        = $8000F7DF;
  517.     synthesizerNotRespondingErr    = $8000F7DE;
  518.     synthesizerErr                = $8000F7DD;
  519.     illegalNoteChannelErr        = $8000F7DC;
  520.     noteChannelNotAllocatedErr    = $8000F7DB;
  521.     tunePlayerFullErr            = $8000F7DA;
  522.     tuneParseErr                = $8000F7D9;
  523.  
  524.     kGetAtomicInstNoExpandedSamples = $01;
  525.     kGetAtomicInstNoOriginalSamples = $02;
  526.     kGetAtomicInstNoSamples        = $03;
  527.     kGetAtomicInstNoKnobList    = $04;
  528.     kGetAtomicInstNoInstrumentInfo = $08;
  529.     kGetAtomicInstOriginalKnobList = $10;
  530.     kGetAtomicInstAllKnobs        = $20;                            {  return even those that are set to default }
  531.  
  532. {
  533.    For non-gm instruments, instrument number of tone description == 0
  534.    If you want to speed up while running, slam the inst num with what Get instrument number returns
  535.    All missing knobs are slammed to the default value
  536. }
  537.     kSetAtomicInstKeepOriginalInstrument = $01;
  538.     kSetAtomicInstShareAcrossParts = $02;                        {  inst disappears when app goes away }
  539.     kSetAtomicInstCallerTosses    = $04;                            {  the caller isn't keeping a copy around (for NASetAtomicInstrument) }
  540.     kSetAtomicInstCallerGuarantees = $08;                        {  the caller guarantees a copy is around }
  541.     kSetAtomicInstInterruptSafe    = $10;                            {  dont move memory at this time (but process at next task time) }
  542.     kSetAtomicInstDontPreprocess = $80;                            {  perform no further preprocessing because either 1)you know the instrument is digitally clean, or 2) you got it from a GetPartAtomic }
  543.  
  544.     kInstrumentNamesModifiable    = 1;
  545.     kInstrumentNamesBoth        = 2;
  546.  
  547. {
  548.  * Structures specific to the GenericMusicComponent
  549.  }
  550.  
  551.     kGenericMusicComponentSubtype = 'gene';
  552.  
  553.  
  554. TYPE
  555.     GenericKnobDescriptionPtr = ^GenericKnobDescription;
  556.     GenericKnobDescription = RECORD
  557.         kd:                        KnobDescription;
  558.         hw1:                    LONGINT;                                {  driver defined  }
  559.         hw2:                    LONGINT;                                {  driver defined  }
  560.         hw3:                    LONGINT;                                {  driver defined  }
  561.         settingsID:                LONGINT;                                {  resource ID list for boolean and popup names  }
  562.     END;
  563.  
  564.     GenericKnobDescriptionListPtr = ^GenericKnobDescriptionList;
  565.     GenericKnobDescriptionList = RECORD
  566.         knobCount:                LONGINT;
  567.         knob:                    ARRAY [0..0] OF GenericKnobDescription;
  568.     END;
  569.  
  570.     GenericKnobDescriptionListHandle    = ^GenericKnobDescriptionListPtr;
  571. { knobTypes for MusicDerivedSetKnob }
  572.  
  573. CONST
  574.     kGenericMusicKnob            = 1;
  575.     kGenericMusicInstrumentKnob    = 2;
  576.     kGenericMusicDrumKnob        = 3;
  577.     kGenericMusicGlobalController = 4;
  578.  
  579.  
  580.  
  581.     kGenericMusicResFirst        = 0;
  582.     kGenericMusicResMiscStringList = 1;                            {  STR# 1: synth name, 2:about author,3:aboutcopyright,4:aboutother  }
  583.     kGenericMusicResMiscLongList = 2;                            {  Long various params, see list below  }
  584.     kGenericMusicResInstrumentList = 3;                            {  NmLs of names and shorts, categories prefixed by '••'  }
  585.     kGenericMusicResDrumList    = 4;                            {  NmLs of names and shorts  }
  586.     kGenericMusicResInstrumentKnobDescriptionList = 5;            {  Knob  }
  587.     kGenericMusicResDrumKnobDescriptionList = 6;                {  Knob  }
  588.     kGenericMusicResKnobDescriptionList = 7;                    {  Knob  }
  589.     kGenericMusicResBitsLongList = 8;                            {  Long back to back bitmaps of controllers, gminstruments, and drums  }
  590.     kGenericMusicResModifiableInstrumentHW = 9;                    {  Shrt same as the hw shorts trailing the instrument names, a shortlist  }
  591.     kGenericMusicResGMTranslation = 10;                            {  Long 128 long entries, 1 for each gm inst, of local instrument numbers 1-n (not hw numbers)  }
  592.     kGenericMusicResROMInstrumentData = 11;                        {  knob lists for ROM instruments, so the knob values may be known  }
  593.     kGenericMusicResAboutPICT    = 12;                            {  picture for aboutlist. must be present for GetAbout call to work  }
  594.     kGenericMusicResLast        = 13;
  595.  
  596. { elements of the misc long list }
  597.     kGenericMusicMiscLongFirst    = 0;
  598.     kGenericMusicMiscLongVoiceCount = 1;
  599.     kGenericMusicMiscLongPartCount = 2;
  600.     kGenericMusicMiscLongModifiableInstrumentCount = 3;
  601.     kGenericMusicMiscLongChannelMask = 4;
  602.     kGenericMusicMiscLongDrumPartCount = 5;
  603.     kGenericMusicMiscLongModifiableDrumCount = 6;
  604.     kGenericMusicMiscLongDrumChannelMask = 7;
  605.     kGenericMusicMiscLongOutputCount = 8;
  606.     kGenericMusicMiscLongLatency = 9;
  607.     kGenericMusicMiscLongFlags    = 10;
  608.     kGenericMusicMiscLongFirstGMHW = 11;                        {  number to add to locate GM main instruments  }
  609.     kGenericMusicMiscLongFirstGMDrumHW = 12;                    {  number to add to locate GM drumkits  }
  610.     kGenericMusicMiscLongFirstUserHW = 13;                        {  First hw number of user instruments (presumed sequential)  }
  611.     kGenericMusicMiscLongLast    = 14;
  612.  
  613.  
  614. TYPE
  615.     GCPartPtr = ^GCPart;
  616.     GCPart = RECORD
  617.         hwInstrumentNumber:        LONGINT;                                {  internal number of recalled instrument  }
  618.         controller:                ARRAY [0..127] OF INTEGER;                {  current values for all controllers  }
  619.         volume:                    LONGINT;                                {  ctrl 7 is special case  }
  620.         polyphony:                LONGINT;
  621.         midiChannel:            LONGINT;                                {  1-16 if in use  }
  622.         id:                        GCInstrumentData;                        {  ToneDescription & knoblist, uncertain length  }
  623.     END;
  624.  
  625. {
  626.  * Calls specific to the GenericMusicComponent
  627.  }
  628.  
  629. CONST
  630.     kMusicGenericRange            = $0100;
  631.     kMusicDerivedRange            = $0200;
  632.  
  633. {
  634.  * Flags in GenericMusicConfigure call
  635.  }
  636.     kGenericMusicDoMIDI            = $01;                            {  implement normal MIDI messages for note, controllers, and program changes 0-127  }
  637.     kGenericMusicBank0            = $02;                            {  implement instrument bank changes on controller 0  }
  638.     kGenericMusicBank32            = $04;                            {  implement instrument bank changes on controller 32  }
  639.     kGenericMusicErsatzMIDI        = $08;                            {  construct MIDI packets, but send them to the derived component  }
  640.     kGenericMusicCallKnobs        = $10;                            {  call the derived component with special knob format call  }
  641.     kGenericMusicCallParts        = $20;                            {  call the derived component with special part format call  }
  642.     kGenericMusicCallInstrument    = $40;                            {  call MusicDerivedSetInstrument for MusicSetInstrument calls  }
  643.     kGenericMusicCallNumber        = $80;                            {  call MusicDerivedSetPartInstrumentNumber for MusicSetPartInstrumentNumber calls, & don't send any C0 or bank stuff  }
  644.     kGenericMusicCallROMInstrument = $0100;                        {  call MusicSetInstrument for MusicSetPartInstrumentNumber for "ROM" instruments, passing params from the ROMi resource  }
  645.     kGenericMusicAllDefaults    = $0200;                        {  indicates that when a new instrument is recalled, all knobs are reset to DEFAULT settings. True for GS modules  }
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652. TYPE
  653. {$IFC TYPED_FUNCTION_POINTERS}
  654.     MusicOfflineDataProcPtr = FUNCTION(SoundData: Ptr; numBytes: LONGINT; myRefCon: LONGINT): ComponentResult;
  655. {$ELSEC}
  656.     MusicOfflineDataProcPtr = ProcPtr;
  657. {$ENDC}
  658.  
  659.     MusicOfflineDataUPP = UniversalProcPtr;
  660.     OfflineSampleTypePtr = ^OfflineSampleType;
  661.     OfflineSampleType = RECORD
  662.         numChannels:            UInt32;                                    { number of channels,  ie mono = 1 }
  663.         sampleRate:                UnsignedFixed;                            { sample rate in Apples Fixed point representation }
  664.         sampleSize:                UInt16;                                    { number of bits in sample }
  665.     END;
  666.  
  667.     InstrumentInfoRecordPtr = ^InstrumentInfoRecord;
  668.     InstrumentInfoRecord = RECORD
  669.         instrumentNumber:        LONGINT;                                {  instrument number (if 0, name is a catagory) }
  670.         flags:                    LONGINT;                                {  show in picker, etc. }
  671.         toneNameIndex:            LONGINT;                                {  index in toneNames (1 based) }
  672.         itxtNameAtomID:            LONGINT;                                {  index in itxtNames (itxt/name by index) }
  673.     END;
  674.  
  675.     InstrumentInfoListPtr = ^InstrumentInfoList;
  676.     InstrumentInfoList = RECORD
  677.         recordCount:            LONGINT;
  678.         toneNames:                Handle;                                    {  name from tone description }
  679.         itxtNames:                QTAtomContainer;                        {  itxt/name atoms for instruments }
  680.         info:                    ARRAY [0..0] OF InstrumentInfoRecord;
  681.     END;
  682.  
  683.     InstrumentInfoListHandle            = ^InstrumentInfoListPtr;
  684. FUNCTION MusicGetDescription(mc: MusicComponent; VAR sd: SynthesizerDescription): ComponentResult;
  685.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  686.     INLINE $2F3C, $0004, $0001, $7000, $A82A;
  687.     {$ENDC}
  688. FUNCTION MusicGetPart(mc: MusicComponent; part: LONGINT; VAR midiChannel: LONGINT; VAR polyphony: LONGINT): ComponentResult;
  689.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  690.     INLINE $2F3C, $000C, $0002, $7000, $A82A;
  691.     {$ENDC}
  692. FUNCTION MusicSetPart(mc: MusicComponent; part: LONGINT; midiChannel: LONGINT; polyphony: LONGINT): ComponentResult;
  693.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  694.     INLINE $2F3C, $000C, $0003, $7000, $A82A;
  695.     {$ENDC}
  696. FUNCTION MusicSetPartInstrumentNumber(mc: MusicComponent; part: LONGINT; instrumentNumber: LONGINT): ComponentResult;
  697.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  698.     INLINE $2F3C, $0008, $0004, $7000, $A82A;
  699.     {$ENDC}
  700.  
  701. FUNCTION MusicGetPartInstrumentNumber(mc: MusicComponent; part: LONGINT): ComponentResult;
  702.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  703.     INLINE $2F3C, $0004, $0005, $7000, $A82A;
  704.     {$ENDC}
  705. FUNCTION MusicStorePartInstrument(mc: MusicComponent; part: LONGINT; instrumentNumber: LONGINT): ComponentResult;
  706.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  707.     INLINE $2F3C, $0008, $0006, $7000, $A82A;
  708.     {$ENDC}
  709.  
  710. FUNCTION MusicGetPartAtomicInstrument(mc: MusicComponent; part: LONGINT; VAR ai: AtomicInstrument; flags: LONGINT): ComponentResult;
  711.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  712.     INLINE $2F3C, $000C, $0009, $7000, $A82A;
  713.     {$ENDC}
  714. FUNCTION MusicSetPartAtomicInstrument(mc: MusicComponent; part: LONGINT; aiP: AtomicInstrumentPtr; flags: LONGINT): ComponentResult;
  715.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  716.     INLINE $2F3C, $000C, $000A, $7000, $A82A;
  717.     {$ENDC}
  718.  
  719. {  Obsolete calls }
  720. FUNCTION MusicGetInstrumentKnobDescriptionObsolete(mc: MusicComponent; knobIndex: LONGINT; mkd: UNIV Ptr): ComponentResult;
  721.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  722.     INLINE $2F3C, $0008, $000D, $7000, $A82A;
  723.     {$ENDC}
  724. FUNCTION MusicGetDrumKnobDescriptionObsolete(mc: MusicComponent; knobIndex: LONGINT; mkd: UNIV Ptr): ComponentResult;
  725.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  726.     INLINE $2F3C, $0008, $000E, $7000, $A82A;
  727.     {$ENDC}
  728. FUNCTION MusicGetKnobDescriptionObsolete(mc: MusicComponent; knobIndex: LONGINT; mkd: UNIV Ptr): ComponentResult;
  729.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  730.     INLINE $2F3C, $0008, $000F, $7000, $A82A;
  731.     {$ENDC}
  732. FUNCTION MusicGetPartKnob(mc: MusicComponent; part: LONGINT; knobID: LONGINT): ComponentResult;
  733.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  734.     INLINE $2F3C, $0008, $0010, $7000, $A82A;
  735.     {$ENDC}
  736. FUNCTION MusicSetPartKnob(mc: MusicComponent; part: LONGINT; knobID: LONGINT; knobValue: LONGINT): ComponentResult;
  737.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  738.     INLINE $2F3C, $000C, $0011, $7000, $A82A;
  739.     {$ENDC}
  740. FUNCTION MusicGetKnob(mc: MusicComponent; knobID: LONGINT): ComponentResult;
  741.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  742.     INLINE $2F3C, $0004, $0012, $7000, $A82A;
  743.     {$ENDC}
  744. FUNCTION MusicSetKnob(mc: MusicComponent; knobID: LONGINT; knobValue: LONGINT): ComponentResult;
  745.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  746.     INLINE $2F3C, $0008, $0013, $7000, $A82A;
  747.     {$ENDC}
  748. FUNCTION MusicGetPartName(mc: MusicComponent; part: LONGINT; name: StringPtr): ComponentResult;
  749.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  750.     INLINE $2F3C, $0008, $0014, $7000, $A82A;
  751.     {$ENDC}
  752. FUNCTION MusicSetPartName(mc: MusicComponent; part: LONGINT; name: StringPtr): ComponentResult;
  753.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  754.     INLINE $2F3C, $0008, $0015, $7000, $A82A;
  755.     {$ENDC}
  756. FUNCTION MusicFindTone(mc: MusicComponent; VAR td: ToneDescription; VAR libraryIndexOut: LONGINT; VAR fit: UInt32): ComponentResult;
  757.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  758.     INLINE $2F3C, $000C, $0016, $7000, $A82A;
  759.     {$ENDC}
  760. FUNCTION MusicPlayNote(mc: MusicComponent; part: LONGINT; pitch: LONGINT; velocity: LONGINT): ComponentResult;
  761.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  762.     INLINE $2F3C, $000C, $0017, $7000, $A82A;
  763.     {$ENDC}
  764. FUNCTION MusicResetPart(mc: MusicComponent; part: LONGINT): ComponentResult;
  765.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  766.     INLINE $2F3C, $0004, $0018, $7000, $A82A;
  767.     {$ENDC}
  768. FUNCTION MusicSetPartController(mc: MusicComponent; part: LONGINT; controllerNumber: MusicController; controllerValue: LONGINT): ComponentResult;
  769.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  770.     INLINE $2F3C, $000C, $0019, $7000, $A82A;
  771.     {$ENDC}
  772.  
  773. FUNCTION MusicGetPartController(mc: MusicComponent; part: LONGINT; controllerNumber: MusicController): ComponentResult;
  774.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  775.     INLINE $2F3C, $0008, $001A, $7000, $A82A;
  776.     {$ENDC}
  777. FUNCTION MusicGetMIDIProc(mc: MusicComponent; VAR midiSendProc: MusicMIDISendUPP; VAR refCon: LONGINT): ComponentResult;
  778.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  779.     INLINE $2F3C, $0008, $001B, $7000, $A82A;
  780.     {$ENDC}
  781. FUNCTION MusicSetMIDIProc(mc: MusicComponent; midiSendProc: MusicMIDISendUPP; refCon: LONGINT): ComponentResult;
  782.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  783.     INLINE $2F3C, $0008, $001C, $7000, $A82A;
  784.     {$ENDC}
  785. FUNCTION MusicGetInstrumentNames(mc: MusicComponent; modifiableInstruments: LONGINT; VAR instrumentNames: Handle; VAR instrumentCategoryLasts: Handle; VAR instrumentCategoryNames: Handle): ComponentResult;
  786.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  787.     INLINE $2F3C, $0010, $001D, $7000, $A82A;
  788.     {$ENDC}
  789. FUNCTION MusicGetDrumNames(mc: MusicComponent; modifiableInstruments: LONGINT; VAR instrumentNumbers: Handle; VAR instrumentNames: Handle): ComponentResult;
  790.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  791.     INLINE $2F3C, $000C, $001E, $7000, $A82A;
  792.     {$ENDC}
  793. FUNCTION MusicGetMasterTune(mc: MusicComponent): ComponentResult;
  794.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  795.     INLINE $2F3C, $0000, $001F, $7000, $A82A;
  796.     {$ENDC}
  797. FUNCTION MusicSetMasterTune(mc: MusicComponent; masterTune: LONGINT): ComponentResult;
  798.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  799.     INLINE $2F3C, $0004, $0020, $7000, $A82A;
  800.     {$ENDC}
  801.  
  802. FUNCTION MusicGetInstrumentAboutInfo(mc: MusicComponent; part: LONGINT; VAR iai: InstrumentAboutInfo): ComponentResult;
  803.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  804.     INLINE $2F3C, $0008, $0022, $7000, $A82A;
  805.     {$ENDC}
  806. FUNCTION MusicGetDeviceConnection(mc: MusicComponent; index: LONGINT; VAR id1: LONGINT; VAR id2: LONGINT): ComponentResult;
  807.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  808.     INLINE $2F3C, $000C, $0023, $7000, $A82A;
  809.     {$ENDC}
  810. FUNCTION MusicUseDeviceConnection(mc: MusicComponent; id1: LONGINT; id2: LONGINT): ComponentResult;
  811.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  812.     INLINE $2F3C, $0008, $0024, $7000, $A82A;
  813.     {$ENDC}
  814. FUNCTION MusicGetKnobSettingStrings(mc: MusicComponent; knobIndex: LONGINT; isGlobal: LONGINT; VAR settingsNames: Handle; VAR settingsCategoryLasts: Handle; VAR settingsCategoryNames: Handle): ComponentResult;
  815.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  816.     INLINE $2F3C, $0014, $0025, $7000, $A82A;
  817.     {$ENDC}
  818. FUNCTION MusicGetMIDIPorts(mc: MusicComponent; VAR inputPortCount: LONGINT; VAR outputPortCount: LONGINT): ComponentResult;
  819.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  820.     INLINE $2F3C, $0008, $0026, $7000, $A82A;
  821.     {$ENDC}
  822. FUNCTION MusicSendMIDI(mc: MusicComponent; portIndex: LONGINT; VAR mp: MusicMIDIPacket): ComponentResult;
  823.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  824.     INLINE $2F3C, $0008, $0027, $7000, $A82A;
  825.     {$ENDC}
  826. FUNCTION MusicReceiveMIDI(mc: MusicComponent; readHook: MusicMIDIReadHookUPP; refCon: LONGINT): ComponentResult;
  827.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  828.     INLINE $2F3C, $0008, $0028, $7000, $A82A;
  829.     {$ENDC}
  830. FUNCTION MusicStartOffline(mc: MusicComponent; VAR numChannels: UInt32; VAR sampleRate: UnsignedFixed; VAR sampleSize: UInt16; dataProc: MusicOfflineDataUPP; dataProcRefCon: LONGINT): ComponentResult;
  831.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  832.     INLINE $2F3C, $0014, $0029, $7000, $A82A;
  833.     {$ENDC}
  834. FUNCTION MusicSetOfflineTimeTo(mc: MusicComponent; newTimeStamp: LONGINT): ComponentResult;
  835.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  836.     INLINE $2F3C, $0004, $002A, $7000, $A82A;
  837.     {$ENDC}
  838. FUNCTION MusicGetInstrumentKnobDescription(mc: MusicComponent; knobIndex: LONGINT; VAR mkd: KnobDescription): ComponentResult;
  839.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  840.     INLINE $2F3C, $0008, $002B, $7000, $A82A;
  841.     {$ENDC}
  842. FUNCTION MusicGetDrumKnobDescription(mc: MusicComponent; knobIndex: LONGINT; VAR mkd: KnobDescription): ComponentResult;
  843.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  844.     INLINE $2F3C, $0008, $002C, $7000, $A82A;
  845.     {$ENDC}
  846. FUNCTION MusicGetKnobDescription(mc: MusicComponent; knobIndex: LONGINT; VAR mkd: KnobDescription): ComponentResult;
  847.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  848.     INLINE $2F3C, $0008, $002D, $7000, $A82A;
  849.     {$ENDC}
  850. FUNCTION MusicGetInfoText(mc: MusicComponent; selector: LONGINT; VAR textH: Handle; VAR styleH: Handle): ComponentResult;
  851.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  852.     INLINE $2F3C, $000C, $002E, $7000, $A82A;
  853.     {$ENDC}
  854.  
  855. CONST
  856.     kGetInstrumentInfoNoBuiltIn    = $01;
  857.     kGetInstrumentInfoMidiUserInst = $02;
  858.     kGetInstrumentInfoNoIText    = $04;
  859.  
  860. FUNCTION MusicGetInstrumentInfo(mc: MusicComponent; getInstrumentInfoFlags: LONGINT; VAR infoListH: InstrumentInfoListHandle): ComponentResult;
  861.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  862.     INLINE $2F3C, $0008, $002F, $7000, $A82A;
  863.     {$ENDC}
  864.  
  865.  
  866.  
  867. FUNCTION MusicTask(mc: MusicComponent): ComponentResult;
  868.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  869.     INLINE $2F3C, $0000, $0031, $7000, $A82A;
  870.     {$ENDC}
  871. FUNCTION MusicSetPartInstrumentNumberInterruptSafe(mc: MusicComponent; part: LONGINT; instrumentNumber: LONGINT): ComponentResult;
  872.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  873.     INLINE $2F3C, $0008, $0032, $7000, $A82A;
  874.     {$ENDC}
  875. FUNCTION MusicSetPartSoundLocalization(mc: MusicComponent; part: LONGINT; data: Handle): ComponentResult;
  876.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  877.     INLINE $2F3C, $0008, $0033, $7000, $A82A;
  878.     {$ENDC}
  879. FUNCTION MusicGenericConfigure(mc: MusicComponent; mode: LONGINT; flags: LONGINT; baseResID: LONGINT): ComponentResult;
  880.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  881.     INLINE $2F3C, $000C, $0100, $7000, $A82A;
  882.     {$ENDC}
  883. FUNCTION MusicGenericGetPart(mc: MusicComponent; partNumber: LONGINT; VAR part: GCPartPtr): ComponentResult;
  884.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  885.     INLINE $2F3C, $0008, $0101, $7000, $A82A;
  886.     {$ENDC}
  887. FUNCTION MusicGenericGetKnobList(mc: MusicComponent; knobType: LONGINT; VAR gkdlH: GenericKnobDescriptionListHandle): ComponentResult;
  888.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  889.     INLINE $2F3C, $0008, $0102, $7000, $A82A;
  890.     {$ENDC}
  891. FUNCTION MusicGenericSetResourceNumbers(mc: MusicComponent; resourceIDH: Handle): ComponentResult;
  892.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  893.     INLINE $2F3C, $0004, $0103, $7000, $A82A;
  894.     {$ENDC}
  895. FUNCTION MusicDerivedMIDISend(mc: MusicComponent; VAR packet: MusicMIDIPacket): ComponentResult;
  896.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  897.     INLINE $2F3C, $0004, $0200, $7000, $A82A;
  898.     {$ENDC}
  899. FUNCTION MusicDerivedSetKnob(mc: MusicComponent; knobType: LONGINT; knobNumber: LONGINT; knobValue: LONGINT; partNumber: LONGINT; VAR p: GCPart; VAR gkd: GenericKnobDescription): ComponentResult;
  900.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  901.     INLINE $2F3C, $0018, $0201, $7000, $A82A;
  902.     {$ENDC}
  903. FUNCTION MusicDerivedSetPart(mc: MusicComponent; partNumber: LONGINT; VAR p: GCPart): ComponentResult;
  904.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  905.     INLINE $2F3C, $0008, $0202, $7000, $A82A;
  906.     {$ENDC}
  907. FUNCTION MusicDerivedSetInstrument(mc: MusicComponent; partNumber: LONGINT; VAR p: GCPart): ComponentResult;
  908.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  909.     INLINE $2F3C, $0008, $0203, $7000, $A82A;
  910.     {$ENDC}
  911. FUNCTION MusicDerivedSetPartInstrumentNumber(mc: MusicComponent; partNumber: LONGINT; VAR p: GCPart): ComponentResult;
  912.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  913.     INLINE $2F3C, $0008, $0204, $7000, $A82A;
  914.     {$ENDC}
  915. FUNCTION MusicDerivedSetMIDI(mc: MusicComponent; midiProc: MusicMIDISendUPP; refcon: LONGINT; midiChannel: LONGINT): ComponentResult;
  916.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  917.     INLINE $2F3C, $000C, $0205, $7000, $A82A;
  918.     {$ENDC}
  919. FUNCTION MusicDerivedStorePartInstrument(mc: MusicComponent; partNumber: LONGINT; VAR p: GCPart; instrumentNumber: LONGINT): ComponentResult;
  920.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  921.     INLINE $2F3C, $000C, $0206, $7000, $A82A;
  922.     {$ENDC}
  923. FUNCTION MusicDerivedOpenResFile(mc: MusicComponent): ComponentResult;
  924.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  925.     INLINE $2F3C, $0000, $0207, $7000, $A82A;
  926.     {$ENDC}
  927. FUNCTION MusicDerivedCloseResFile(mc: MusicComponent; resRefNum: INTEGER): ComponentResult;
  928.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  929.     INLINE $2F3C, $0002, $0208, $7000, $A82A;
  930.     {$ENDC}
  931.  
  932.  
  933.  
  934.  
  935.  
  936. {  Mask bit for returned value by InstrumentFind. }
  937.  
  938. CONST
  939.     kInstrumentExactMatch        = $00020000;
  940.     kInstrumentRecommendedSubstitute = $00010000;
  941.     kInstrumentQualityField        = $FF000000;
  942.     kInstrumentRoland8BitQuality = $05000000;
  943.  
  944.  
  945. TYPE
  946.     InstrumentAboutInfoHandle            = ^InstrumentAboutInfoPtr;
  947.     GMInstrumentInfoPtr = ^GMInstrumentInfo;
  948.     GMInstrumentInfo = RECORD
  949.         cmpInstID:                LONGINT;
  950.         gmInstNum:                LONGINT;
  951.         instMatch:                LONGINT;
  952.     END;
  953.  
  954.     GMInstrumentInfoHandle                = ^GMInstrumentInfoPtr;
  955.     nonGMInstrumentInfoRecordPtr = ^nonGMInstrumentInfoRecord;
  956.     nonGMInstrumentInfoRecord = RECORD
  957.         cmpInstID:                LONGINT;                                {  if 0, category name }
  958.         flags:                    LONGINT;                                {  match, show in picker }
  959.         toneNameIndex:            LONGINT;                                {  index in toneNames (1 based) }
  960.         itxtNameAtomID:            LONGINT;                                {  index in itxtNames (itxt/name by index) }
  961.     END;
  962.  
  963.     nonGMInstrumentInfoPtr = ^nonGMInstrumentInfo;
  964.     nonGMInstrumentInfo = RECORD
  965.         recordCount:            LONGINT;
  966.         toneNames:                Handle;                                    {  name from tone description }
  967.         itxtNames:                QTAtomContainer;                        {  itext/name atoms for instruments }
  968.         instInfo:                ARRAY [0..0] OF nonGMInstrumentInfoRecord;
  969.     END;
  970.  
  971.     nonGMInstrumentInfoHandle            = ^nonGMInstrumentInfoPtr;
  972.     InstCompInfoPtr = ^InstCompInfo;
  973.     InstCompInfo = RECORD
  974.         infoSize:                LONGINT;                                {  size of this record }
  975.         InstrumentLibraryName:    Str31;
  976.         InstrumentLibraryITxt:    QTAtomContainer;                        {  itext/name atoms for instruments }
  977.         GMinstrumentCount:        LONGINT;
  978.         GMinstrumentInfo:        GMInstrumentInfoHandle;
  979.         GMdrumCount:            LONGINT;
  980.         GMdrumInfo:                GMInstrumentInfoHandle;
  981.         nonGMinstrumentCount:    LONGINT;
  982.         nonGMinstrumentInfo:    nonGMInstrumentInfoHandle;
  983.     END;
  984.  
  985.     InstCompInfoHandle                    = ^InstCompInfoPtr;
  986. FUNCTION InstrumentGetInst(ci: ComponentInstance; instID: LONGINT; VAR atomicInst: AtomicInstrument; flags: LONGINT): ComponentResult;
  987.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  988.     INLINE $2F3C, $000C, $0001, $7000, $A82A;
  989.     {$ENDC}
  990. FUNCTION InstrumentGetInfo(ci: ComponentInstance; getInstrumentInfoFlags: LONGINT; VAR instInfo: InstCompInfoHandle): ComponentResult;
  991.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  992.     INLINE $2F3C, $0008, $0002, $7000, $A82A;
  993.     {$ENDC}
  994. FUNCTION InstrumentInitialize(ci: ComponentInstance; initFormat: LONGINT; initParams: UNIV Ptr): ComponentResult;
  995.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  996.     INLINE $2F3C, $0008, $0003, $7000, $A82A;
  997.     {$ENDC}
  998. FUNCTION InstrumentOpenComponentResFile(ci: ComponentInstance; VAR resFile: INTEGER): ComponentResult;
  999.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1000.     INLINE $2F3C, $0004, $0004, $7000, $A82A;
  1001.     {$ENDC}
  1002. FUNCTION InstrumentCloseComponentResFile(ci: ComponentInstance; resFile: INTEGER): ComponentResult;
  1003.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1004.     INLINE $2F3C, $0002, $0005, $7000, $A82A;
  1005.     {$ENDC}
  1006. FUNCTION InstrumentGetComponentRefCon(ci: ComponentInstance; VAR refCon: UNIV Ptr): ComponentResult;
  1007.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1008.     INLINE $2F3C, $0004, $0006, $7000, $A82A;
  1009.     {$ENDC}
  1010. FUNCTION InstrumentSetComponentRefCon(ci: ComponentInstance; refCon: UNIV Ptr): ComponentResult;
  1011.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1012.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  1013.     {$ENDC}
  1014. FUNCTION InstrumentGetSynthesizerType(ci: ComponentInstance; VAR synthesizerType: OSType): ComponentResult;
  1015.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1016.     INLINE $2F3C, $0004, $0008, $7000, $A82A;
  1017.     {$ENDC}
  1018.  
  1019.  
  1020. {--------------------------
  1021.     Types
  1022. --------------------------}
  1023.  
  1024. CONST
  1025.     kNoteRequestNoGM            = 1;                            {  dont degrade to a GM synth  }
  1026.     kNoteRequestNoSynthType        = 2;                            {  dont degrade to another synth of same type but different name  }
  1027.     kNoteRequestSynthMustMatch    = 4;                            {  synthType must be a match, including kGMSynthComponentSubType  }
  1028.  
  1029.  
  1030. TYPE
  1031.     NoteAllocator                        = ComponentInstance;
  1032.     NoteRequestInfoPtr = ^NoteRequestInfo;
  1033.     NoteRequestInfo = RECORD
  1034.         flags:                    SInt8;                                    {  1: dont accept GM match, 2: dont accept same-synth-type match  }
  1035.         reserved:                SInt8;                                    {  must be zero  }
  1036.         polyphony:                BigEndianShort;                            {  Maximum number of voices  }
  1037.         typicalPolyphony:        BigEndianFixed;                            {  Hint for level mixing  }
  1038.     END;
  1039.  
  1040.     NoteRequestPtr = ^NoteRequest;
  1041.     NoteRequest = RECORD
  1042.         info:                    NoteRequestInfo;
  1043.         tone:                    ToneDescription;
  1044.     END;
  1045.  
  1046.     NoteChannel = ^LONGINT;
  1047.  
  1048.  
  1049. CONST
  1050.     kPickDontMix                = 1;                            {  dont mix instruments with drum sounds  }
  1051.     kPickSameSynth                = 2;                            {  only allow the same device that went in, to come out  }
  1052.     kPickUserInsts                = 4;                            {  show user insts in addition to ROM voices  }
  1053.     kPickEditAllowEdit            = 8;                            {  lets user switch over to edit mode  }
  1054.     kPickEditAllowPick            = 16;                            {  lets the user switch over to pick mode  }
  1055.     kPickEditSynthGlobal        = 32;                            {  edit the global knobs of the synth  }
  1056.     kPickEditControllers        = 64;                            {  edit the controllers of the notechannel  }
  1057.  
  1058.  
  1059.     kNoteAllocatorComponentType    = 'nota';
  1060.  
  1061.  
  1062. {--------------------------------
  1063.     Note Allocator Prototypes
  1064. --------------------------------}
  1065. FUNCTION NARegisterMusicDevice(na: NoteAllocator; synthType: OSType; VAR name: Str31; VAR connections: SynthesizerConnections): ComponentResult;
  1066.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1067.     INLINE $2F3C, $000C, $0000, $7000, $A82A;
  1068.     {$ENDC}
  1069. FUNCTION NAUnregisterMusicDevice(na: NoteAllocator; index: LONGINT): ComponentResult;
  1070.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1071.     INLINE $2F3C, $0004, $0001, $7000, $A82A;
  1072.     {$ENDC}
  1073. FUNCTION NAGetRegisteredMusicDevice(na: NoteAllocator; index: LONGINT; VAR synthType: OSType; VAR name: Str31; VAR connections: SynthesizerConnections; VAR mc: MusicComponent): ComponentResult;
  1074.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1075.     INLINE $2F3C, $0014, $0002, $7000, $A82A;
  1076.     {$ENDC}
  1077. FUNCTION NASaveMusicConfiguration(na: NoteAllocator): ComponentResult;
  1078.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1079.     INLINE $2F3C, $0000, $0003, $7000, $A82A;
  1080.     {$ENDC}
  1081. FUNCTION NANewNoteChannel(na: NoteAllocator; VAR noteRequest: NoteRequest; VAR outChannel: NoteChannel): ComponentResult;
  1082.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1083.     INLINE $2F3C, $0008, $0004, $7000, $A82A;
  1084.     {$ENDC}
  1085. FUNCTION NADisposeNoteChannel(na: NoteAllocator; noteChannel: NoteChannel): ComponentResult;
  1086.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1087.     INLINE $2F3C, $0004, $0005, $7000, $A82A;
  1088.     {$ENDC}
  1089. FUNCTION NAGetNoteChannelInfo(na: NoteAllocator; noteChannel: NoteChannel; VAR index: LONGINT; VAR part: LONGINT): ComponentResult;
  1090.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1091.     INLINE $2F3C, $000C, $0006, $7000, $A82A;
  1092.     {$ENDC}
  1093. FUNCTION NAPrerollNoteChannel(na: NoteAllocator; noteChannel: NoteChannel): ComponentResult;
  1094.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1095.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  1096.     {$ENDC}
  1097. FUNCTION NAUnrollNoteChannel(na: NoteAllocator; noteChannel: NoteChannel): ComponentResult;
  1098.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1099.     INLINE $2F3C, $0004, $0008, $7000, $A82A;
  1100.     {$ENDC}
  1101.  
  1102. FUNCTION NASetNoteChannelVolume(na: NoteAllocator; noteChannel: NoteChannel; volume: Fixed): ComponentResult;
  1103.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1104.     INLINE $2F3C, $0008, $000B, $7000, $A82A;
  1105.     {$ENDC}
  1106. FUNCTION NAResetNoteChannel(na: NoteAllocator; noteChannel: NoteChannel): ComponentResult;
  1107.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1108.     INLINE $2F3C, $0004, $000C, $7000, $A82A;
  1109.     {$ENDC}
  1110. FUNCTION NAPlayNote(na: NoteAllocator; noteChannel: NoteChannel; pitch: LONGINT; velocity: LONGINT): ComponentResult;
  1111.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1112.     INLINE $2F3C, $000C, $000D, $7000, $A82A;
  1113.     {$ENDC}
  1114. FUNCTION NASetController(na: NoteAllocator; noteChannel: NoteChannel; controllerNumber: LONGINT; controllerValue: LONGINT): ComponentResult;
  1115.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1116.     INLINE $2F3C, $000C, $000E, $7000, $A82A;
  1117.     {$ENDC}
  1118. FUNCTION NASetKnob(na: NoteAllocator; noteChannel: NoteChannel; knobNumber: LONGINT; knobValue: LONGINT): ComponentResult;
  1119.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1120.     INLINE $2F3C, $000C, $000F, $7000, $A82A;
  1121.     {$ENDC}
  1122. FUNCTION NAFindNoteChannelTone(na: NoteAllocator; noteChannel: NoteChannel; VAR td: ToneDescription; VAR instrumentNumber: LONGINT): ComponentResult;
  1123.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1124.     INLINE $2F3C, $000C, $0010, $7000, $A82A;
  1125.     {$ENDC}
  1126. FUNCTION NASetInstrumentNumber(na: NoteAllocator; noteChannel: NoteChannel; instrumentNumber: LONGINT): ComponentResult;
  1127.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1128.     INLINE $2F3C, $0008, $0011, $7000, $A82A;
  1129.     {$ENDC}
  1130.  
  1131.  
  1132. FUNCTION NAPickInstrument(na: NoteAllocator; filterProc: ModalFilterUPP; prompt: StringPtr; VAR sd: ToneDescription; flags: UInt32; refCon: LONGINT; reserved1: LONGINT; reserved2: LONGINT): ComponentResult;
  1133.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1134.     INLINE $2F3C, $001C, $0012, $7000, $A82A;
  1135.     {$ENDC}
  1136. FUNCTION NAPickArrangement(na: NoteAllocator; filterProc: ModalFilterUPP; prompt: StringPtr; zero1: LONGINT; zero2: LONGINT; t: Track; songName: StringPtr): ComponentResult;
  1137.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1138.     INLINE $2F3C, $0018, $0013, $7000, $A82A;
  1139.     {$ENDC}
  1140.  
  1141. FUNCTION NASetDefaultMIDIInput(na: NoteAllocator; VAR sc: SynthesizerConnections): ComponentResult;
  1142.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1143.     INLINE $2F3C, $0004, $0015, $7000, $A82A;
  1144.     {$ENDC}
  1145. FUNCTION NAGetDefaultMIDIInput(na: NoteAllocator; VAR sc: SynthesizerConnections): ComponentResult;
  1146.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1147.     INLINE $2F3C, $0004, $0016, $7000, $A82A;
  1148.     {$ENDC}
  1149.  
  1150. FUNCTION NAUseDefaultMIDIInput(na: NoteAllocator; readHook: MusicMIDIReadHookUPP; refCon: LONGINT; flags: UInt32): ComponentResult;
  1151.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1152.     INLINE $2F3C, $000C, $0019, $7000, $A82A;
  1153.     {$ENDC}
  1154. FUNCTION NALoseDefaultMIDIInput(na: NoteAllocator): ComponentResult;
  1155.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1156.     INLINE $2F3C, $0000, $001A, $7000, $A82A;
  1157.     {$ENDC}
  1158. FUNCTION NAStuffToneDescription(na: NoteAllocator; gmNumber: LONGINT; VAR td: ToneDescription): ComponentResult;
  1159.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1160.     INLINE $2F3C, $0008, $001B, $7000, $A82A;
  1161.     {$ENDC}
  1162. FUNCTION NACopyrightDialog(na: NoteAllocator; p: PicHandle; author: StringPtr; copyright: StringPtr; other: StringPtr; title: StringPtr; filterProc: ModalFilterUPP; refCon: LONGINT): ComponentResult;
  1163.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1164.     INLINE $2F3C, $001C, $001C, $7000, $A82A;
  1165.     {$ENDC}
  1166.  
  1167. {
  1168.       kNADummyOneSelect = 29
  1169.       kNADummyTwoSelect = 30
  1170. }
  1171.  
  1172. FUNCTION NAGetIndNoteChannel(na: NoteAllocator; index: LONGINT; VAR nc: NoteChannel; VAR seed: LONGINT): ComponentResult;
  1173.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1174.     INLINE $2F3C, $000C, $001F, $7000, $A82A;
  1175.     {$ENDC}
  1176.  
  1177. FUNCTION NAGetMIDIPorts(na: NoteAllocator; VAR inputPorts: QTMIDIPortListHandle; VAR outputPorts: QTMIDIPortListHandle): ComponentResult;
  1178.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1179.     INLINE $2F3C, $0008, $0021, $7000, $A82A;
  1180.     {$ENDC}
  1181. FUNCTION NAGetNoteRequest(na: NoteAllocator; noteChannel: NoteChannel; VAR nrOut: NoteRequest): ComponentResult;
  1182.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1183.     INLINE $2F3C, $0008, $0022, $7000, $A82A;
  1184.     {$ENDC}
  1185. FUNCTION NASendMIDI(na: NoteAllocator; noteChannel: NoteChannel; VAR mp: MusicMIDIPacket): ComponentResult;
  1186.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1187.     INLINE $2F3C, $0008, $0023, $7000, $A82A;
  1188.     {$ENDC}
  1189. FUNCTION NAPickEditInstrument(na: NoteAllocator; filterProc: ModalFilterUPP; prompt: StringPtr; refCon: LONGINT; nc: NoteChannel; ai: AtomicInstrument; flags: LONGINT): ComponentResult;
  1190.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1191.     INLINE $2F3C, $0018, $0024, $7000, $A82A;
  1192.     {$ENDC}
  1193. FUNCTION NANewNoteChannelFromAtomicInstrument(na: NoteAllocator; instrument: AtomicInstrumentPtr; flags: LONGINT; VAR outChannel: NoteChannel): ComponentResult;
  1194.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1195.     INLINE $2F3C, $000C, $0025, $7000, $A82A;
  1196.     {$ENDC}
  1197. FUNCTION NASetAtomicInstrument(na: NoteAllocator; noteChannel: NoteChannel; instrument: AtomicInstrumentPtr; flags: LONGINT): ComponentResult;
  1198.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1199.     INLINE $2F3C, $000C, $0026, $7000, $A82A;
  1200.     {$ENDC}
  1201.  
  1202.  
  1203. FUNCTION NAGetKnob(na: NoteAllocator; noteChannel: NoteChannel; knobNumber: LONGINT; VAR knobValue: LONGINT): ComponentResult;
  1204.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1205.     INLINE $2F3C, $000C, $0028, $7000, $A82A;
  1206.     {$ENDC}
  1207. FUNCTION NATask(na: NoteAllocator): ComponentResult;
  1208.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1209.     INLINE $2F3C, $0000, $0029, $7000, $A82A;
  1210.     {$ENDC}
  1211. FUNCTION NASetNoteChannelBalance(na: NoteAllocator; noteChannel: NoteChannel; balance: LONGINT): ComponentResult;
  1212.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1213.     INLINE $2F3C, $0008, $002A, $7000, $A82A;
  1214.     {$ENDC}
  1215. FUNCTION NASetInstrumentNumberInterruptSafe(na: NoteAllocator; noteChannel: NoteChannel; instrumentNumber: LONGINT): ComponentResult;
  1216.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1217.     INLINE $2F3C, $0008, $002B, $7000, $A82A;
  1218.     {$ENDC}
  1219. FUNCTION NASetNoteChannelSoundLocalization(na: NoteAllocator; noteChannel: NoteChannel; data: Handle): ComponentResult;
  1220.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1221.     INLINE $2F3C, $0008, $002C, $7000, $A82A;
  1222.     {$ENDC}
  1223. FUNCTION NAGetController(na: NoteAllocator; noteChannel: NoteChannel; controllerNumber: LONGINT; VAR controllerValue: LONGINT): ComponentResult;
  1224.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1225.     INLINE $2F3C, $000C, $002D, $7000, $A82A;
  1226.     {$ENDC}
  1227.  
  1228.  
  1229.  
  1230.  
  1231.  
  1232. CONST
  1233.     kTuneQueueDepth                = 8;                            {  Deepest you can queue tune segments  }
  1234.  
  1235.  
  1236.  
  1237. TYPE
  1238.     TuneStatusPtr = ^TuneStatus;
  1239.     TuneStatus = RECORD
  1240.         tune:                    LongintPtr;                                {  currently playing tune  }
  1241.         tunePtr:                LongintPtr;                                {  position within currently playing piece  }
  1242.         time:                    TimeValue;                                {  current tune time  }
  1243.         queueCount:                INTEGER;                                {  how many pieces queued up?  }
  1244.         queueSpots:                INTEGER;                                {  How many more tunepieces can be queued  }
  1245.         queueTime:                TimeValue;                                {  How much time is queued up? (can be very inaccurate)  }
  1246.         reserved:                ARRAY [0..2] OF LONGINT;
  1247.     END;
  1248.  
  1249. {$IFC TYPED_FUNCTION_POINTERS}
  1250.     TuneCallBackProcPtr = PROCEDURE((CONST)VAR status: TuneStatus; refCon: LONGINT);
  1251. {$ELSEC}
  1252.     TuneCallBackProcPtr = ProcPtr;
  1253. {$ENDC}
  1254.  
  1255. {$IFC TYPED_FUNCTION_POINTERS}
  1256.     TunePlayCallBackProcPtr = PROCEDURE(VAR event: UInt32; seed: LONGINT; refCon: LONGINT);
  1257. {$ELSEC}
  1258.     TunePlayCallBackProcPtr = ProcPtr;
  1259. {$ENDC}
  1260.  
  1261.     TuneCallBackUPP = UniversalProcPtr;
  1262.     TunePlayCallBackUPP = UniversalProcPtr;
  1263.     TunePlayer                            = ComponentInstance;
  1264.  
  1265. CONST
  1266.     kTunePlayerComponentType    = 'tune';
  1267.  
  1268.  
  1269. FUNCTION TuneSetHeader(tp: TunePlayer; VAR header: UInt32): ComponentResult;
  1270.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1271.     INLINE $2F3C, $0004, $0004, $7000, $A82A;
  1272.     {$ENDC}
  1273. FUNCTION TuneGetTimeBase(tp: TunePlayer; VAR tb: TimeBase): ComponentResult;
  1274.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1275.     INLINE $2F3C, $0004, $0005, $7000, $A82A;
  1276.     {$ENDC}
  1277. FUNCTION TuneSetTimeScale(tp: TunePlayer; scale: TimeScale): ComponentResult;
  1278.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1279.     INLINE $2F3C, $0004, $0006, $7000, $A82A;
  1280.     {$ENDC}
  1281. FUNCTION TuneGetTimeScale(tp: TunePlayer; VAR scale: TimeScale): ComponentResult;
  1282.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1283.     INLINE $2F3C, $0004, $0007, $7000, $A82A;
  1284.     {$ENDC}
  1285. FUNCTION TuneGetIndexedNoteChannel(tp: TunePlayer; i: LONGINT; VAR nc: NoteChannel): ComponentResult;
  1286.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1287.     INLINE $2F3C, $0008, $0008, $7000, $A82A;
  1288.     {$ENDC}
  1289.  
  1290. { Values for when to start. }
  1291.  
  1292. CONST
  1293.     kTuneStartNow                = 1;                            {  start after buffer is implied  }
  1294.     kTuneDontClipNotes            = 2;                            {  allow notes to finish their durations outside sample  }
  1295.     kTuneExcludeEdgeNotes        = 4;                            {  dont play notes that start at end of tune  }
  1296.     kTuneQuickStart                = 8;                            {  Leave all the controllers where they are, ignore start time  }
  1297.     kTuneLoopUntil                = 16;                            {  loop a queued tune if there's nothing else in the queue  }
  1298.     kTuneStartNewMaster            = 16384;
  1299.  
  1300. FUNCTION TuneQueue(tp: TunePlayer; VAR tune: UInt32; tuneRate: Fixed; tuneStartPosition: UInt32; tuneStopPosition: UInt32; queueFlags: UInt32; callBackProc: TuneCallBackUPP; refCon: LONGINT): ComponentResult;
  1301.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1302.     INLINE $2F3C, $001C, $000A, $7000, $A82A;
  1303.     {$ENDC}
  1304. FUNCTION TuneInstant(tp: TunePlayer; tune: UNIV Ptr; tunePosition: LONGINT): ComponentResult;
  1305.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1306.     INLINE $2F3C, $0008, $000B, $7000, $A82A;
  1307.     {$ENDC}
  1308. FUNCTION TuneGetStatus(tp: TunePlayer; VAR status: TuneStatus): ComponentResult;
  1309.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1310.     INLINE $2F3C, $0004, $000C, $7000, $A82A;
  1311.     {$ENDC}
  1312. { Values for stopping. }
  1313.  
  1314. CONST
  1315.     kTuneStopFade                = 1;                            {  do a quick, synchronous fadeout  }
  1316.     kTuneStopSustain            = 2;                            {  don't silece notes  }
  1317.     kTuneStopInstant            = 4;                            {  silence notes fast (else, decay them)  }
  1318.     kTuneStopReleaseChannels    = 8;                            {  afterwards, let the channels go  }
  1319.  
  1320. FUNCTION TuneStop(tp: TunePlayer; stopFlags: LONGINT): ComponentResult;
  1321.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1322.     INLINE $2F3C, $0004, $000D, $7000, $A82A;
  1323.     {$ENDC}
  1324.  
  1325. FUNCTION TuneSetVolume(tp: TunePlayer; volume: Fixed): ComponentResult;
  1326.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1327.     INLINE $2F3C, $0004, $0010, $7000, $A82A;
  1328.     {$ENDC}
  1329. FUNCTION TuneGetVolume(tp: TunePlayer): ComponentResult;
  1330.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1331.     INLINE $2F3C, $0000, $0011, $7000, $A82A;
  1332.     {$ENDC}
  1333. FUNCTION TunePreroll(tp: TunePlayer): ComponentResult;
  1334.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1335.     INLINE $2F3C, $0000, $0012, $7000, $A82A;
  1336.     {$ENDC}
  1337. FUNCTION TuneUnroll(tp: TunePlayer): ComponentResult;
  1338.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1339.     INLINE $2F3C, $0000, $0013, $7000, $A82A;
  1340.     {$ENDC}
  1341. FUNCTION TuneSetNoteChannels(tp: TunePlayer; count: UInt32; VAR noteChannelList: NoteChannel; playCallBackProc: TunePlayCallBackUPP; refCon: LONGINT): ComponentResult;
  1342.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1343.     INLINE $2F3C, $0010, $0014, $7000, $A82A;
  1344.     {$ENDC}
  1345. FUNCTION TuneSetPartTranspose(tp: TunePlayer; part: UInt32; transpose: LONGINT; velocityShift: LONGINT): ComponentResult;
  1346.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1347.     INLINE $2F3C, $000C, $0015, $7000, $A82A;
  1348.     {$ENDC}
  1349.  
  1350. FUNCTION TuneGetNoteAllocator(tp: TunePlayer): NoteAllocator;
  1351.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1352.     INLINE $2F3C, $0000, $0017, $7000, $A82A;
  1353.     {$ENDC}
  1354. FUNCTION TuneSetSofter(tp: TunePlayer; softer: LONGINT): ComponentResult;
  1355.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1356.     INLINE $2F3C, $0004, $0018, $7000, $A82A;
  1357.     {$ENDC}
  1358. FUNCTION TuneTask(tp: TunePlayer): ComponentResult;
  1359.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1360.     INLINE $2F3C, $0000, $0019, $7000, $A82A;
  1361.     {$ENDC}
  1362. FUNCTION TuneSetBalance(tp: TunePlayer; balance: LONGINT): ComponentResult;
  1363.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1364.     INLINE $2F3C, $0004, $001A, $7000, $A82A;
  1365.     {$ENDC}
  1366. FUNCTION TuneSetSoundLocalization(tp: TunePlayer; data: Handle): ComponentResult;
  1367.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1368.     INLINE $2F3C, $0004, $001B, $7000, $A82A;
  1369.     {$ENDC}
  1370. FUNCTION TuneSetHeaderWithSize(tp: TunePlayer; VAR header: UInt32; size: UInt32): ComponentResult;
  1371.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1372.     INLINE $2F3C, $0008, $001C, $7000, $A82A;
  1373.     {$ENDC}
  1374.  
  1375. { flags for part mix. }
  1376.  
  1377. CONST
  1378.     kTuneMixMute                = 1;                            {  disable a part  }
  1379.     kTuneMixSolo                = 2;                            {  if any parts soloed, play only soloed parts  }
  1380.  
  1381.  
  1382. FUNCTION TuneSetPartMix(tp: TunePlayer; partNumber: UInt32; volume: LONGINT; balance: LONGINT; mixFlags: LONGINT): ComponentResult;
  1383.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1384.     INLINE $2F3C, $0010, $001D, $7000, $A82A;
  1385.     {$ENDC}
  1386. FUNCTION TuneGetPartMix(tp: TunePlayer; partNumber: UInt32; VAR volumeOut: LONGINT; VAR balanceOut: LONGINT; VAR mixFlagsOut: LONGINT): ComponentResult;
  1387.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1388.     INLINE $2F3C, $0010, $001E, $7000, $A82A;
  1389.     {$ENDC}
  1390.  
  1391.  
  1392. TYPE
  1393.     MusicOpWord                            = UInt32;
  1394.     MusicOpWordPtr                        = ^UInt32;
  1395. {     QuickTime Music Track Event Formats:
  1396.  
  1397.     At this time, QuickTime music tracks support 5 different event types -- REST events,
  1398.     short NOTE events, short CONTROL events, short GENERAL events, Long NOTE events, 
  1399.     long CONTROL events, and variable GENERAL events.
  1400.  
  1401.         • REST Event (4 bytes/event):
  1402.     
  1403.             (0 0 0) (5-bit UNUSED) (24-bit Rest Duration)
  1404.         
  1405.         • Short NOTE Events (4 bytes/event):
  1406.     
  1407.             (0 0 1) (5-bit Part) (6-bit Pitch) (7-bit Volume) (11-bit Duration)
  1408.         
  1409.             where:    Pitch is offset by 32 (Actual pitch = pitch field + 32)
  1410.  
  1411.         • Short CONTROL Events (4 bytes/event):
  1412.     
  1413.             (0 1 0) (5-bit Part) (8-bit Controller) (1-bit UNUSED) (1-bit Sign) (7-bit MSB) (7-bit LSB)
  1414.                                                                          ( or 15-bit Signed Value)
  1415.         • Short GENERAL Event (4 bytes/event):
  1416.     
  1417.             (0 1 1) (1-bit UNUSED) (12-bit Sub-Type) (16-bit Value)
  1418.     
  1419.         • Long NOTE Events (8 bytes/event):
  1420.     
  1421.             (1 0 0 1) (12-bit Part) (1-bit UNUSED) (7-bit Pitch) (1-bit UNUSED) (7-bit Volume)
  1422.             (1 0) (8-bit UNUSED) (22-bit Duration)
  1423.         
  1424.         • Long CONTROL Event (8 bytes/event):
  1425.         
  1426.             (1 0 1 0) (12-bit Part) (16-bit Value MSB) 
  1427.             (1 0) (14-bit Controller) (16-bit Value LSB)
  1428.     
  1429.         • Long KNOB Event (8 bytes/event):
  1430.     
  1431.             (1 0 1 1) (12-bit Sub-Type) (16-bit Value MSB)
  1432.             (1 0) (14-bit KNOB) (16-bit Value LSB)
  1433.     
  1434.         • Variable GENERAL Length Events (N bytes/event):
  1435.     
  1436.             (1 1 1 1) (12-bit Sub-Type) (16-bit Length)
  1437.                 :
  1438.             (32-bit Data values)
  1439.                 :
  1440.             (1 1) (14-bit UNUSED) (16-bit Length)
  1441.     
  1442.             where:    Length field is the number of LONG words in the record.
  1443.                     Lengths include the first and last long words (Minimum length = 2)
  1444.                 
  1445.     The following event type values have not been used yet and are reserved for 
  1446.     future expansion:
  1447.         
  1448.         • (1 0 0 0)        (8 bytes/event)
  1449.         • (1 1 0 0)        (N bytes/event)
  1450.         • (1 1 0 1)        (N bytes/event)
  1451.         • (1 1 1 0)        (N bytes/event)
  1452.         
  1453.     For all events, the following generalizations apply:
  1454.     
  1455.         -    All duration values are specified in Millisecond units.
  1456.         -     Pitch values are intended to map directly to the MIDI key numbers.
  1457.         -    Controllers from 0 to 127 correspond to the standard MIDI controllers.
  1458.             Controllers greater than 127 correspond to other controls (i.e., Pitch Bend, 
  1459.             Key Pressure, and Channel Pressure).    
  1460. }
  1461.  
  1462. {  Defines for the implemented music event data fields }
  1463.  
  1464. CONST
  1465.     kRestEventType                = $00000000;                    {  lower 3-bits  }
  1466.     kNoteEventType                = $00000001;                    {  lower 3-bits  }
  1467.     kControlEventType            = $00000002;                    {  lower 3-bits  }
  1468.     kMarkerEventType            = $00000003;                    {  lower 3-bits  }
  1469.     kUndefined1EventType        = $00000008;                    {  4-bits  }
  1470.     kXNoteEventType                = $00000009;                    {  4-bits  }
  1471.     kXControlEventType            = $0000000A;                    {  4-bits  }
  1472.     kKnobEventType                = $0000000B;                    {  4-bits  }
  1473.     kUndefined2EventType        = $0000000C;                    {  4-bits  }
  1474.     kUndefined3EventType        = $0000000D;                    {  4-bits  }
  1475.     kUndefined4EventType        = $0000000E;                    {  4-bits  }
  1476.     kGeneralEventType            = $0000000F;                    {  4-bits  }
  1477.     kXEventLengthBits            = $00000002;                    {  2 bits: indicates 8-byte event record  }
  1478.     kGeneralEventLengthBits        = $00000003;                    {  2 bits: indicates variable length event record  }
  1479.     kEventLen                    = 1;                            {  length of events in long words  }
  1480.     kXEventLen                    = 2;
  1481.     kRestEventLen                = 1;                            {  length of events in long words  }
  1482.     kNoteEventLen                = 1;
  1483.     kControlEventLen            = 1;
  1484.     kMarkerEventLen                = 1;
  1485.     kXNoteEventLen                = 2;
  1486.     kXControlEventLen            = 2;
  1487.     kGeneralEventLen            = 2;                            {  2 or more, however  }
  1488.                                                                 {  Universal Event Defines }
  1489.     kEventLengthFieldPos        = 30;                            {  by looking at these two bits of the 1st or last word               }
  1490.     kEventLengthFieldWidth        = 2;                            {  of an event you can determine the event length                       }
  1491.                                                                 {  length field: 0 & 1 => 1 long; 2 => 2 longs; 3 => variable length  }
  1492.     kEventTypeFieldPos            = 29;                            {  event type field for short events  }
  1493.     kEventTypeFieldWidth        = 3;                            {  short type is 3 bits  }
  1494.     kXEventTypeFieldPos            = 28;                            {  event type field for extended events  }
  1495.     kXEventTypeFieldWidth        = 4;                            {  extended type is 4 bits  }
  1496.     kEventPartFieldPos            = 24;
  1497.     kEventPartFieldWidth        = 5;
  1498.     kXEventPartFieldPos            = 16;                            {  in the 1st long word  }
  1499.     kXEventPartFieldWidth        = 12;                            {  Rest Events }
  1500.     kRestEventDurationFieldPos    = 0;
  1501.     kRestEventDurationFieldWidth = 24;
  1502.     kRestEventDurationMax        = $00FFFFFF;                    {  Note Events }
  1503.     kNoteEventPitchFieldPos        = 18;
  1504.     kNoteEventPitchFieldWidth    = 6;
  1505.     kNoteEventPitchOffset        = 32;                            {  add to value in pitch field to get actual pitch  }
  1506.     kNoteEventVolumeFieldPos    = 11;
  1507.     kNoteEventVolumeFieldWidth    = 7;
  1508.     kNoteEventVolumeOffset        = 0;                            {  add to value in volume field to get actual volume  }
  1509.     kNoteEventDurationFieldPos    = 0;
  1510.     kNoteEventDurationFieldWidth = 11;
  1511.     kNoteEventDurationMax        = $000007FF;
  1512.     kXNoteEventPitchFieldPos    = 0;                            {  in the 1st long word  }
  1513.     kXNoteEventPitchFieldWidth    = 16;
  1514.     kXNoteEventDurationFieldPos    = 0;                            {  in the 2nd long word  }
  1515.     kXNoteEventDurationFieldWidth = 22;
  1516.     kXNoteEventDurationMax        = $003FFFFF;
  1517.     kXNoteEventVolumeFieldPos    = 22;                            {  in the 2nd long word  }
  1518.     kXNoteEventVolumeFieldWidth    = 7;                            {  Control Events }
  1519.     kControlEventControllerFieldPos = 16;
  1520.     kControlEventControllerFieldWidth = 8;
  1521.     kControlEventValueFieldPos    = 0;
  1522.     kControlEventValueFieldWidth = 16;
  1523.     kXControlEventControllerFieldPos = 0;                        {  in the 2nd long word  }
  1524.     kXControlEventControllerFieldWidth = 16;
  1525.     kXControlEventValueFieldPos    = 0;                            {  in the 1st long word  }
  1526.     kXControlEventValueFieldWidth = 16;                            {  Knob Events }
  1527.     kKnobEventValueHighFieldPos    = 0;                            {  1st long word  }
  1528.     kKnobEventValueHighFieldWidth = 16;
  1529.     kKnobEventKnobFieldPos        = 16;                            {  2nd long word  }
  1530.     kKnobEventKnobFieldWidth    = 14;
  1531.     kKnobEventValueLowFieldPos    = 0;                            {  2nd long word  }
  1532.     kKnobEventValueLowFieldWidth = 16;                            {  Marker Events }
  1533.     kMarkerEventSubtypeFieldPos    = 16;
  1534.     kMarkerEventSubtypeFieldWidth = 8;
  1535.     kMarkerEventValueFieldPos    = 0;
  1536.     kMarkerEventValueFieldWidth    = 16;                            {  General Events }
  1537.     kGeneralEventSubtypeFieldPos = 16;                            {  in the last long word  }
  1538.     kGeneralEventSubtypeFieldWidth = 14;
  1539.     kGeneralEventLengthFieldPos    = 0;                            {  in the 1st & last long words  }
  1540.     kGeneralEventLengthFieldWidth = 16;
  1541.  
  1542. {$IFC TARGET_RT_LITTLE_ENDIAN }
  1543.     kEndMarkerValue                = $00000060;
  1544.  
  1545. {$ELSEC}
  1546.     kEndMarkerValue                = $60000000;
  1547.  
  1548. {$ENDC}  {TARGET_RT_LITTLE_ENDIAN}
  1549.  
  1550. {  General Event Defined Types }
  1551.     kGeneralEventNoteRequest    = 1;                            {  Encapsulates NoteRequest data structure  }
  1552.     kGeneralEventPartKey        = 4;
  1553.     kGeneralEventTuneDifference    = 5;                            {  Contains a standard sequence, with end marker, for the tune difference of a sequence piece (halts QuickTime 2.0 Music)  }
  1554.     kGeneralEventAtomicInstrument = 6;                            {  Encapsulates AtomicInstrument record  }
  1555.     kGeneralEventKnob            = 7;                            {  knobID/knobValue pairs; smallest event is 4 longs  }
  1556.     kGeneralEventMIDIChannel    = 8;                            {  used in tune header, one longword identifies the midi channel it originally came from  }
  1557.     kGeneralEventPartChange        = 9;                            {  used in tune sequence, one longword identifies the tune part which can now take over this part's note channel (similar to program change) (halts QuickTime 2.0 Music) }
  1558.     kGeneralEventNoOp            = 10;                            {  guaranteed to do nothing and be ignored. (halts QuickTime 2.0 Music)  }
  1559.     kGeneralEventUsedNotes        = 11;                            {  four longwords specifying which midi notes are actually used, 0..127 msb to lsb  }
  1560.     kGeneralEventPartMix        = 12;                            {  three longwords: Fixed volume, long balance, long flags  }
  1561.  
  1562. {  Marker Event Defined Types        // marker is 60 ee vv vv in hex, where e = event type, and v = value }
  1563.     kMarkerEventEnd                = 0;                            {  marker type 0 means: value 0 - stop, value != 0 - ignore }
  1564.     kMarkerEventBeat            = 1;                            {  value 0 = single beat; anything else is 65536ths-of-a-beat (quarter note) }
  1565.     kMarkerEventTempo            = 2;                            {  value same as beat marker, but indicates that a tempo event should be computed (based on where the next beat or tempo marker is) and emitted upon export }
  1566.  
  1567.     kCurrentlyNativeEndian        = 1;
  1568.     kCurrentlyNotNativeEndian    = 2;
  1569.  
  1570. { UPP call backs }
  1571.     uppMusicMIDISendProcInfo = $00000FF0;
  1572.     uppMusicMIDIReadHookProcInfo = $000003F0;
  1573.     uppMusicOfflineDataProcInfo = $00000FF0;
  1574.     uppTuneCallBackProcInfo = $000003C0;
  1575.     uppTunePlayCallBackProcInfo = $00000FC0;
  1576.  
  1577. FUNCTION NewMusicMIDISendProc(userRoutine: MusicMIDISendProcPtr): MusicMIDISendUPP;
  1578.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1579.     INLINE $2E9F;
  1580.     {$ENDC}
  1581.  
  1582. FUNCTION NewMusicMIDIReadHookProc(userRoutine: MusicMIDIReadHookProcPtr): MusicMIDIReadHookUPP;
  1583.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1584.     INLINE $2E9F;
  1585.     {$ENDC}
  1586.  
  1587. FUNCTION NewMusicOfflineDataProc(userRoutine: MusicOfflineDataProcPtr): MusicOfflineDataUPP;
  1588.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1589.     INLINE $2E9F;
  1590.     {$ENDC}
  1591.  
  1592. FUNCTION NewTuneCallBackProc(userRoutine: TuneCallBackProcPtr): TuneCallBackUPP;
  1593.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1594.     INLINE $2E9F;
  1595.     {$ENDC}
  1596.  
  1597. FUNCTION NewTunePlayCallBackProc(userRoutine: TunePlayCallBackProcPtr): TunePlayCallBackUPP;
  1598.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1599.     INLINE $2E9F;
  1600.     {$ENDC}
  1601.  
  1602. FUNCTION CallMusicMIDISendProc(self: ComponentInstance; refCon: LONGINT; VAR mmp: MusicMIDIPacket; userRoutine: MusicMIDISendUPP): ComponentResult;
  1603.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1604.     INLINE $205F, $4E90;
  1605.     {$ENDC}
  1606.  
  1607. FUNCTION CallMusicMIDIReadHookProc(VAR mp: MusicMIDIPacket; myRefCon: LONGINT; userRoutine: MusicMIDIReadHookUPP): ComponentResult;
  1608.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1609.     INLINE $205F, $4E90;
  1610.     {$ENDC}
  1611.  
  1612. FUNCTION CallMusicOfflineDataProc(SoundData: Ptr; numBytes: LONGINT; myRefCon: LONGINT; userRoutine: MusicOfflineDataUPP): ComponentResult;
  1613.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1614.     INLINE $205F, $4E90;
  1615.     {$ENDC}
  1616.  
  1617. PROCEDURE CallTuneCallBackProc({CONST}VAR status: TuneStatus; refCon: LONGINT; userRoutine: TuneCallBackUPP);
  1618.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1619.     INLINE $205F, $4E90;
  1620.     {$ENDC}
  1621.  
  1622. PROCEDURE CallTunePlayCallBackProc(VAR event: UInt32; seed: LONGINT; refCon: LONGINT; userRoutine: TunePlayCallBackUPP);
  1623.     {$IFC TARGET_OS_MAC AND TARGET_CPU_68K AND NOT TARGET_RT_MAC_CFM}
  1624.     INLINE $205F, $4E90;
  1625.     {$ENDC}
  1626.  
  1627. {$ALIGN RESET}
  1628. {$POP}
  1629.  
  1630. {$SETC UsingIncludes := QuickTimeMusicIncludes}
  1631.  
  1632. {$ENDC} {__QUICKTIMEMUSIC__}
  1633.  
  1634. {$IFC NOT UsingIncludes}
  1635.  END.
  1636. {$ENDC}
  1637.